home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
hity wydania
/
Bank smakow
/
BankSmakow.air
/
BankSmakow.swf
/
scripts
/
com
/
makingwaves
/
model
/
ModelLocator.as
Wrap
Text File
|
2009-12-16
|
4KB
|
140 lines
package com.makingwaves.model
{
import com.adobe.cairngorm.model.IModelLocator;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.IEventDispatcher;
import flash.utils.Dictionary;
import mx.collections.ArrayCollection;
import mx.events.PropertyChangeEvent;
public class ModelLocator implements IModelLocator, IEventDispatcher
{
private static var allowInstantiation:Boolean;
private static var instance:ModelLocator;
private var _selectedProducts:Dictionary;
private var _bindingEventDispatcher:EventDispatcher;
private var _recipes:ArrayCollection;
private var _fridgeProducts:ArrayCollection;
public function ModelLocator()
{
_bindingEventDispatcher = new EventDispatcher(IEventDispatcher(this));
super();
if(allowInstantiation)
{
_fridgeProducts = new ArrayCollection();
_recipes = new ArrayCollection();
return;
}
throw new Error("Use getInstance()");
}
public static function getInstance() : ModelLocator
{
if(instance == null)
{
allowInstantiation = true;
instance = new ModelLocator();
allowInstantiation = false;
}
return instance;
}
public function dispatchEvent(param1:Event) : Boolean
{
return _bindingEventDispatcher.dispatchEvent(param1);
}
private function set _1335272161selectedProducts(param1:Dictionary) : void
{
_selectedProducts = param1;
}
private function set _1082416293recipes(param1:ArrayCollection) : void
{
_recipes = param1;
}
private function set _377251465fridgeProducts(param1:ArrayCollection) : void
{
_fridgeProducts = param1;
}
public function willTrigger(param1:String) : Boolean
{
return _bindingEventDispatcher.willTrigger(param1);
}
public function get fridgeProducts() : ArrayCollection
{
return _fridgeProducts;
}
[Bindable(event="propertyChange")]
public function set recipes(param1:ArrayCollection) : void
{
var _loc2_:Object = this.recipes;
if(_loc2_ !== param1)
{
this._1082416293recipes = param1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"recipes",_loc2_,param1));
}
}
public function addEventListener(param1:String, param2:Function, param3:Boolean = false, param4:int = 0, param5:Boolean = false) : void
{
_bindingEventDispatcher.addEventListener(param1,param2,param3,param4,param5);
}
public function removeEventListener(param1:String, param2:Function, param3:Boolean = false) : void
{
_bindingEventDispatcher.removeEventListener(param1,param2,param3);
}
[Bindable(event="propertyChange")]
public function set fridgeProducts(param1:ArrayCollection) : void
{
var _loc2_:Object = this.fridgeProducts;
if(_loc2_ !== param1)
{
this._377251465fridgeProducts = param1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"fridgeProducts",_loc2_,param1));
}
}
public function get selectedProducts() : Dictionary
{
return _selectedProducts;
}
public function get recipes() : ArrayCollection
{
return _recipes;
}
public function hasEventListener(param1:String) : Boolean
{
return _bindingEventDispatcher.hasEventListener(param1);
}
[Bindable(event="propertyChange")]
public function set selectedProducts(param1:Dictionary) : void
{
var _loc2_:Object = this.selectedProducts;
if(_loc2_ !== param1)
{
this._1335272161selectedProducts = param1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"selectedProducts",_loc2_,param1));
}
}
}
}